function Common () {
    this.P_TOP = 1;
    this.P_RIGHT = 2;
    this.P_BOTTOM = 3;
    this.P_LEFT = 4;
}

Common.prototype = {
    showTips : function (params) {
        var dom = $(params.selector);
        var w = dom.width();
        var h = dom.height();
        switch (params.position) {
            case this.P_TOP:
                dom.animate({top: -h, opacity: "hide"}, 0).animate({top: 0, opacity: "show"}, 500, function () {
                    if (params.hide) {
                        window.setTimeout(function () {
                            dom.animate({top: -h, opacity: "hide"});
                        }, 3000);
                    }
                });
                break;
            case this.P_RIGHT:
                dom.animate({right: -w, opacity: "hide"}, 0).animate({right: 0, opacity: "show"}, 500, function () {
                    if (params.hide) {
                        window.setTimeout(function () {
                            dom.animate({right: -w, opacity: "hide"});
                        }, 3000);
                    }
                });
                break;
            case this.P_BOTTOM:
                dom.animate({bottom: -h, opacity: "hide"}, 0).animate({bottom: 0, opacity: "show"}, 500, function () {
                    if (params.hide) {
                        window.setTimeout(function () {
                            dom.animate({bottom: -h, opacity: "hide"});
                        }, 3000);
                    }
                });
                break;
            case this.P_LEFT:
                dom.animate({left: -w, opacity: "hide"}, 0).animate({left: 0, opacity: "show"}, 500, function () {
                    if (params.hide) {
                        window.setTimeout(function () {
                            dom.animate({left: -w, opacity: "hide"});
                        }, 3000);
                    }
                });
                break;
        }
    },
    
    getCheckboxValues : function (name) {
        var checkboxValues = [];
        var checkboxs = document.getElementsByName(name);
        for (var i = 0; i < checkboxs.length; i += 1) {
            if (checkboxs[i].checked) {
                checkboxValues[checkboxValues.length] = checkboxs[i].value;
            }
        }
        return checkboxValues;
    }
};

var $C = new Common();

var $E = function (id) {
    return document.getElementById(id);
};
var $EN = function (name) {
    return document.getElementsByName(name);
};
var $ET = function (tag) {
    return document.getElementsByTagName(tag);
};